package com.smart.manager.system.entities.body;

import com.smart.common.entities.core.BaseSearch;
import com.smart.manager.system.entities.views.ModuleView;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;


/**
 * @author Administrator
 */
public class RSystemApi {

    @Data
    @EqualsAndHashCode(callSuper = true)
    @ApiModel("RSystemApi1")
    public static class SearchBody extends BaseSearch {


        @ApiModelProperty("所属模块")
        private String moduleCode;


        @ApiModelProperty("权限标题")
        private String title;

        @ApiModelProperty("权限表达式")
        private String expr;

        @ApiModelProperty("权限标题")
        private String url;

        @ApiModelProperty("是否自定权限")
        private Boolean custom;


    }


    @Data
    @ApiModel("RSystemApi2")
    public static class EditBody implements Serializable {


        @ApiModelProperty("所属模块")
        @NotNull(message = "所属模块 不能为空")
        @Valid
        private ModuleView module;

        @ApiModelProperty("API标题")
        @NotBlank(message = "字典代码 不能为空")
        @Length(max = 30, message = "字典代码 不能为空")
        private String title;


        @ApiModelProperty("API权限表达式")
        @Length(max = 100, message = "编码长度不能超过100")
        private String expr;

        @ApiModelProperty("显示排序值")
        private Integer sort;


    }


}
